/**
 * Created by wangxh on 16/12/26.
 */
import send from './http'
export default {
  _cti_sendAction (jsonData, state) {
    let req = {
      url: state.globalLet._cti_url,
      jsonData
    }
    return send.fetchByJsonp(req, 'get')
  },
  //   获取未读消息的number
  refreshNoticeUndealNum (data, state) {
    let req = {
      data: {},
      action: 'app.notify.refreshUndealNum'
    }
    return send.fetch(req, 'post', true)
  },
  //   获取系统公告的number
  syncSysAnnouncement (data, state) {
    let req = {
      data: {},
      action: 'app.notify.syncSysAnnouncement'
    }
    return send.fetch(req, 'post', true)
  },
  // 获取通知列表
  getNoticeList (data, state) {
    let req = {
      data: data,
      action: 'app.notify.getNotifyList'
    }
    return send.fetch(req, 'post', true)
  },
  // 通过id获取通知列表的详情
  getNoticeDetailById (data, state) {
    let req = {
      data: data,
      action: 'app.notify.refreshUndealNum'
    }
    return send.fetch(req, 'post', true)
  },
  // 通过id删除通知列表
  delNotice (data, state) {
    let req = {
      data: data,
      action: 'app.notify.removeNotify'
    }
    return send.fetch(req, 'post', true)
  },
  // 将通知变为已读
  readNotify (data, state) {
    let req = {
      data: data,
      action: 'app.notify.readNotify'
    }
    return send.fetch(req, 'post', true)
  },
// 清空已读通知
  clearNotify (data, state) {
    let req = {
      data: data,
      action: 'app.notify.clearNotify'
    }
    return send.fetch(req, 'post', true)
  },
  // 全部标记为已读
  batchReadNotify (data, state) {
    let req = {
      data: data,
      action: 'app.notify.batchReadNotify'
    }
    return send.fetch(req, 'post', true)
  },
  getBusNoyifyList (data, state) {
    let req = {
      data: data,
      action: 'app.notify.getBusinessList'
    }
    return send.fetch(req, 'post', true)
  },
  markCallSheetThroughCall (data, state) {
    let req = {
      data: data,
      action: 'app.callSheet.markCallSheetThroughCall',
      action_id: Math.random(),
      sessionId: state.globalLet.phone_data.userId
    }
    return send.fetch(req, 'post')
  },
  getConcurrent (data, state) {
    let req = {
      data: data,
      action: 'app.batch.getConcurrent',
      action_id: Math.random(),
      sessionId: state.globalLet.phone_data.userId
    }
    return send.fetch(req, 'post')
  },
  popupCust (data, state) {
    let req = {
      data: data,
      action: 'app.popup.popupCust',
      action_id: Math.random(),
      sessionId: state.globalLet.phone_data.userId
    }
    return send.fetch(req, 'post')
  },
  childSatisfactionSupport (data, state) {
    let req = {
      data: data,
      action: 'config.ivr.pbx.childSatisfactionSupport'
    }
    return send.fetch(req, 'post', true)
  },
  _cti_pbx_sendAction (jsonData, url) {
    let req = {
      url: url,
      jsonData
    }
    return send.fetchByJsonp(req, 'get')
  }
}
